
import Koa from 'koa';
import Router from './router/router';
import Bodyparser from 'koa-bodyparser';
import Cors from 'koa2-cors';
import { verifyToken } from './middleware/auth';

const app = new Koa();
/**解决跨域 */
app.keys = ['some secret hurr'];
app.use(Cors());
/**解析request.body */
app.use(Bodyparser());
/**登录验证 */
app.use(verifyToken());
/**注册router */
app.use(Router.routes());
app.listen(3100);
console.log('\x1B[36m%s\x1B[0m', 'Server:http://localhost:3100/');
